package com.zhdl.hardware_contact.hardware_param.repository;

import com.project.common.repository.BaseRepository;
import com.zhdl.hardware_contact.hardware_param.entity.HardwareAbsPos;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface HardwareAbsPosDao extends BaseRepository<HardwareAbsPos,Integer> {
    List<HardwareAbsPos> findByHardwareId(Integer id);

    @Transactional
    @Modifying
    @Query(value = "DELETE FROM hardware_abs_pos WHERE hardware_id = :hardwareId", nativeQuery = true)
    void deleteHardwareByHardwareId(@Param("hardwareId") Integer hardwareId);
}
